perm filename DRUM.DOC[SYS,BGB]1 blob
sn#001403 filedate 1971-12-19 generic text, type T, neo UTF8
00100 DRUM
00200
00300 SAIL ACCESSIBLE
00400 DYNAMIC STORAGE ALLOCATION ROUTINES FOR USER FAST BANDS
00500
00600 Bruce g. Baumgart
00700
00800
00900
01000 The require source file statement for declaring the DRUM routines is
01100
01200 REQUIRE "DRUMER[SYS,BGB]" SOURCE_FILE;
01300
01400 The SAIL declarations for the drum routines are:
01500
01600 REQUIRE "DRUM[SYS,BGB]" LOAD_MODULE;
01700 EXTERNAL INTEGER PROCEDURE DRUMA (INTEGER SIZE);
01800 EXTERNAL PROCEDURE DRUMO (INTEGER ADR,FBPTR);
01900 EXTERNAL PROCEDURE DRUMI (INTEGER ADR,FBPTR);
02000 EXTERNAL PROCEDURE DRUMR (INTEGER FBPTR);
02100
02200
02300
02400 THE DRUM
02500
02600 The DRUM is a General Precision Inc., Librafile 4800, Mass
02700 Memory Librascope, fixed head disc. There were three of them built,
02800 ours and two that are at AEC's LRL. The DRUM used to have 144
02900 (decimal) bands, of which half are still addressible after the big
03000 crash in the summer of '69. The surviving 72 bands each hold 76K
03100 words, for a total capacity of 5.472 Megawords. At Present the drum
03200 is mostly used for swapping at the rate of one band per job.
03300 However, any user may have up to 32 (decimal) of the bands. by
03400 calling the Special Librascope UUO's, see section II.D.9 of Moorer's
03500 Sailon 55.2.
03600
03700 The drum rotates at 900 RPM, which is 86 milli seconds per
03800 revolution, which is also the maximum amount of time you might have
03900 to wait for the start of a drum transfer. Once started, the drum can
04000 read or write at core speeds, 1.6 micro seconds per word.
00100 ALLOCATE and RELEASE
00200
00300 Allocate FBPTR ← DRUMA(SIZE);
00400 Release DRUMR(FBPTR);
00500
00600 The routines named DRUMA and DRUMR allocate and release
00700 blocks of drum space by the so called "First Fit" method suggested in
00800 Knuth's section on Dynamic Storage Allocation, p435, v1. The storage
00900 lists are kept in core and allow up to one thousand blocks.
01000 The allocate routine takes an integer argument which
01100 specifies the number of words desired in a block, and returns an
01200 integer called the Fast Band Pointer. The FBPTR contains a band
01300 number in bits 0-5, a sector address in bits 6-17 and the size of the
01400 block in words in bits 18-35.
01500 The release routine returns the FBPTR's drum space to the
01600 free storage list.
01700
01800
01900
02000
02100 INPUT and OUTPUT
02200
02300 Input DRUMI(ADR,FBPTR);
02400 Output DRUMO(ADR,FBPTR);
02500
02600 The routines named DRUMI and DRUMO transfer blocks of core
02700 memory in from the drum or out to the drum. Only sanity requires the
02800 use of a DRUMO before a DRUMI. The drum I/O routines take two
02900 integer arguments which specify a core address, a drum address and a
03000 block size in words. Core address of arrays may be gotten in sail by
03100 either:
03200 ADR ← POINT (36,ARRY[1],35);
03300 or more swiftly:
03400 QUICK_CODE MOVE 11,ARRY; MOVEM 11,ADR;END;
00100 BEGIN "FBTEST"
00200 DEFINE α="COMMENT";
00300 REQUIRE "DRUMER[SYS,BGB]" SOURCE_FILE;
00400 REQUIRE "RANDER[SYS,BGB]" SOURCE_FILE;
00500 α SIMULATION PARAMETERS;
00600 DEFINE BLKCNT="100",BLKSIZ="10000";
00700 INTEGER ARRAY CONTENT,LIFE,SIZE,FBPTR[1:BLKCNT];
00800 α Misc temporaries;
00900 INTEGER I,J,X,SIZ,PTR,ADR;
01000
01100 PROCEDURE CREATE (INTEGER I);
01200 BEGIN "CREATE"
01300 SIZE[I]←SIZ← RANDOM*BLKSIZ+10;
01400 LIFE[I] ← RANDOM*100;
01500 CONTENT[I]←X← RANDOM*10000000;
01600 FBPTR[I]←PTR← DRUMA(SIZ);
01700 BEGIN
01800 INTEGER ARRAY BLOCK[1:SIZ];
01900 BLOCK[1]← X;
02000 ARRBLT(BLOCK[2],BLOCK[1],SIZ-1);
02100 ADR ← POINT(36,BLOCK[1],35);
02200 DRUMO(ADR,PTR);
02300 END;
02400 OUTCHR("C");
02500 END "CREATE";
02600
02700 PROCEDURE DESTROY (INTEGER I);
02800 BEGIN "DESTROY"
02900 SIZ ← SIZE[I];
03000 X ← CONTENT[I];
03100 PTR ← FBPTR[I];
03200 BEGIN
03300 INTEGER K;
03400 INTEGER ARRAY BLOCK[1:SIZ];
03500 ADR ← POINT(36,BLOCK[1],35);
03600 DRUMI(ADR,PTR);
03700 FOR K←1 STEP 1 UNTIL SIZ DO
03800 IF BLOCK[K]≠X THEN OUTCHR("-");
03900 DRUMR(PTR);
04000 END;
04100 OUTCHR("D");
04200 END "DESTROY";
00100 α INITIAL CREATION;
00200 FOR I←1 STEP 1 UNTIL BLKCNT DO CREATE(I);
00300 OUTSTR(13&10&"INITIALIZATION COMPLETED."&13&10);
00400 α DYNAMIC STORAGE EXERCISER;
00500 WHILE TRUE DO
00600 BEGIN "FOREVER"
00700 OUTCHR(".");
00800 FOR I←1 STEP 1 UNTIL BLKCNT DO
00900 IF (LIFE[I]←LIFE[I]-1)≤0 THEN
01000 BEGIN DESTROY(I);CREATE(I);END;
01100 END "FOREVER";
01200
01300 END "FBTEST"